{% extends "base.html" %} 

{% block head %}
  <style type="text/css">
    @import url('/css/code.css');
    @import url('/css/highlight.css');
  </style>
  <script type="text/JavaScript" src="/js/parse.js"></script>
{% endblock head %}

{% block body %}

  <div id="wrap">
    {% if message %}
    <div class="message">
      {{message}}
    </div>
    {% endif %}
  
    {% if error %}
    <div class="error">
      {{error}}
    </div>
    {% endif %}
  
    {% if description %}
    <p>
      {{description}}
    </p>
    {% endif %}
  
    {% if text %}
    <pre class="javascript script">{% autoescape on %}{{text}}{% endautoescape %}</pre>
    {% endif %}
  
    {% if is_admin %}
    <p>
      <form method="POST" class="adminform">
        <label>Text <textarea name="sample_text">{{text}}</textarea></label>
        <label>Description <textarea name="sample_description">{{description}}</textarea></label>
        <label>Global? <input type="checkbox" name="sample_is_global" {% if is_global %}checked="checked"{% endif %} /></label>
        <input type="hidden" name="sample_id" value="{{id}}" />
        <input type="hidden" name="action" value="updatesample" />
  	    <input type="submit" value="Save" />
  	  </form>
    </p>
    {% endif %}
  </div>

  <script type="text/javascript">
  	for ( var i = 0 , candidates = document.getElementsByTagName( "pre" ) ;
  	candidates[i] ; i++ ) {
  	if ( String.prototype.parse[ candidates[i].className.toLowerCase() ] )
  	  candidates[i].removeChild( candidates[i].firstChild ).nodeValue.parse(
  	        candidates[i].getAttribute( "class" ) ,
  	      candidates[i] , "link" ) ;
  	}
  </script>

{% endblock body %}